package com.fhzn.boss.config;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;

import javax.annotation.PostConstruct;
import java.io.File;
import java.nio.file.Paths;

/**
 * @author fhzn
 */
@ConfigurationProperties(prefix = "system")
@Data
@Slf4j
public class SystemProperties {


    /**
     * 磁盘挂载路径
     */
    private String dataPath;
    private Boolean ifDeleteContainerAfterJobFinish;


    @PostConstruct
    public void init() {
        File file = Paths.get(dataPath).toFile();
        if (!file.exists()) {
            log.info("create data path:" + dataPath);
            file.mkdirs();
        }
    }
}
